using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using SideShow.Driver.ComInterop;

namespace SideShow.Driver
{
    public class DriverEntry<T, R> : IDriverEntry where T : SideShowDevice<R>, new() where R : SideShowDriver, new()
    {
        private T _device;

        #region IDriverEntry Members

        public void OnDeinitialize(IWDFDriver pWdfDriver)
        {
            
        }

        public void OnDeviceAdd(IWDFDriver pWdfDriver, IWDFDeviceInitialize pWdfDeviceInit)
        {
            _device = new T();
            IWDFDevice wdfDevice = null;
            pWdfDriver.CreateDevice(pWdfDeviceInit, _device, out wdfDevice);
            SideShowQueue<T, R> q = new SideShowQueue<T, R>(_device);
            IWDFIoQueue defaultQueue = null;
            wdfDevice.CreateIoQueue(q, 1, _WDF_IO_QUEUE_DISPATCH_TYPE.WdfIoQueueDispatchSequential, 1, 0, out defaultQueue);

        }

        public void OnInitialize(IWDFDriver pWdfDriver)
        {
            
        }

        #endregion
    }
}